package tech.mobi.child;

import java.util.ArrayList;
import java.util.HashMap;

import tech.mobi.child.GoodClientListAct.GoodClient;
import tech.mobi.child.adapter.GoodClientListAdapter;
import tech.mobi.child.base.BaseAct;
import tech.mobi.child.bean.GroupBean;
import tech.mobi.child.service.MainService;
import tech.mobi.child.utils.Configuration;
import tech.mobi.child.utils.OSCPullToRefreshListView;
import tech.mobi.child.utils.Task;
import tech.mobi.child.utils.TaskType;
import tech.mobi.child.utils.Tools;
import tech.mobi.child.utils.User;
import tech.mobi.child.utils.OSCPullToRefreshListView.OnRefreshListener;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AbsListView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class CZDAClientListTxtAddMainAct extends BaseAct implements OnClickListener {

	private Button btnBack;
	private Button btnUpload;
	
	private TextView tvTitle;
	private ProgressBar progress;
	
	private EditText etTxtTitleName;
	private EditText etTxtDesc;
	private Button btnSubmit;
	
	
	/*****************************
	 * 成长档案类别
			以下是显示文字
			flag=4:童言无忌;
			flag=6:喜欢的故事;
			flag=8:教师评语;
	 *****************************/
	private String strTypeId = "";
	private String strTitle;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.czda_client_txt_add_main);

		progress = (ProgressBar) this.findViewById(R.id.progress);
		tvTitle = (TextView) this.findViewById(R.id.tvTitle);
		btnBack = (Button) this.findViewById(R.id.btnBack);
		btnBack.setOnClickListener(this);
		btnUpload = (Button) this.findViewById(R.id.btnUpload);
		btnUpload.setOnClickListener(this);
		
		etTxtTitleName = (EditText) this.findViewById(R.id.etTxtTitleName);
		etTxtDesc = (EditText) this.findViewById(R.id.etTxtDesc);
		btnSubmit = (Button) this.findViewById(R.id.btnSubmit);
		btnSubmit.setOnClickListener(this);
		
		
		Intent intent = this.getIntent();
		if (intent != null && !"".equals(intent.getStringExtra("typeId"))) {
			strTypeId = intent.getStringExtra("typeId").toString();
		}
		if (intent != null && !"".equals(intent.getStringExtra("titleName"))) {
			strTitle = intent.getStringExtra("titleName");
			tvTitle.setText(getText(Integer.parseInt(strTitle)));
		} else {
			tvTitle.setText("");
		}
	}

	@Override
	public void init() {

	}

	@SuppressWarnings("unchecked")
	@Override
	public void refresh(Object... param) {
	}

	@Override
	public void onClick(View v) {
		if (v.getId() == R.id.btnBack) {
			finish();
		} else if (v.getId() == R.id.btnSubmit) {
			String strTitleName = etTxtTitleName.getText().toString();
			String strTxtDesc = etTxtDesc.getText().toString();
			
			Toast.makeText(this, strTitleName+"\n"+strTxtDesc, Toast.LENGTH_LONG).show();
		}

	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}

	private void setClickEnable(boolean bool) {
		btnBack.setEnabled(bool);
		btnUpload.setEnabled(bool);
		btnSubmit.setEnabled(bool);
		if (bool) {
			this.progress.setVisibility(View.GONE);
		} else {
			this.progress.setVisibility(View.VISIBLE);
		}
		
	}
}
